<?php

namespace app\admin\controller;

use app\common\controller\Backend;

/**
 * 意向合作申请
 */
class Cooperation extends Backend
{
    /**
     * Cooperation模型对象
     * @var object
     * @phpstan-var \app\admin\model\Cooperation
     */
    protected object $model;

    protected array|string $preExcludeFields = ['id', 'create_time'];

    protected string|array $quickSearchField = ['id'];

    public function initialize (): void
    {
        parent::initialize();
        $this->model = new \app\admin\model\Cooperation;
    }


    /**
     * 若需重写查看、编辑、删除等方法，请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写
     */
    public function set ()
    {
        $id = $this->request->post('id');
        $info = $this->model->find($id);
        $info->status = 1;
        $ret = $info->save();
        if (!$ret) {
            $this->error('设置失败');
        }
        $this->success('设置成功');
    }
}